<?php 

class Event_ProductPreSave extends Crud_Event_Handler 
{
	protected $_type = 'preSave';
	
	/**
	 * Run handler with options array.
	 * 
	 * @param OrdersRow $row
	 * @return void
	 */
	public function run($row)
	{
		if ($row instanceof Crud_Section_Row) {
			$row = $row->getRow();
		}
		
		/* @var $row ProductRow */
		if ($row->getCount() != $this->_getParam('count')) {
			$row->setRestsAt(new Zend_Db_Expr('now()'));
			$row->save();
		}

		$sex = $this->_getParam('gender');
		if($sex == '')
		{
			throw new Crud_Exception("���� ��� ����������� ��� ����������.");
		}
		
	}
	

}
